package com.xyz.controller;

import com.xyz.aop.ObjectParam;
import com.xyz.dto.BusinessAnnounceDto;
import com.xyz.dto.RepairWorkOrderDto;
import com.xyz.dto.SelectPageAllDto;
import com.xyz.service.AnnounceService;
import com.xyz.service.RepairService;
import com.xyz.util.dto.DataResult;
import com.xyz.util.dto.LoginInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("announce")
public class AnnounceController {

    private static final Logger logger = LoggerFactory.getLogger(AnnounceController.class);

    @Autowired
    private AnnounceService announceService;

    @PostMapping("/insertAnnounceByRep")
    public DataResult insertAnnounceByRep(LoginInfo loginInfo,@ObjectParam BusinessAnnounceDto businessAnnounceDto) {
        try {
            return announceService.insertAnnounce(loginInfo,businessAnnounceDto);
        } catch (Exception e) {
            logger.error("insertAnnounceByRep", e);
            return DataResult.build9500();
        }
    }

    @PostMapping("/insertAnnounceByUpkeep")
    public DataResult insertAnnounceByUpkeep(LoginInfo loginInfo,@ObjectParam BusinessAnnounceDto businessAnnounceDto) {
        try {
            return announceService.insertAnnounceByUpkeep(loginInfo,businessAnnounceDto);
        } catch (Exception e) {
            logger.error("insertAnnounceByUpkeep", e);
            return DataResult.build9500();
        }
    }



}
